package com.test1;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.Window;
import android.view.WindowManager;
public class GameActivity extends Activity{
	private GameEvent event = new GameEvent();
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		 requestWindowFeature(Window.FEATURE_NO_TITLE);		 	 //设置全屏
	     getWindow().setFlags(
	        WindowManager.LayoutParams.FLAG_FULLSCREEN,
	        WindowManager.LayoutParams.FLAG_FULLSCREEN
	    );        
	    Game.currentactivity = this;
	    Game.init();
	    Log.d("lijun", "onCreate");
	}
	
	@Override
	public boolean onTouchEvent(MotionEvent event){
		int action = event.getAction();
		this.event.x = (int)event.getX();
		this.event.y = (int)event.getY();
		if( action== MotionEvent.ACTION_UP ){//判断事件类型
//			Game.scene.click( event.getX(), event.getY() );
			this.event.type = GameEvent.release;
			Game.scene.onRelease( this.event );
		}else if( action == MotionEvent.ACTION_DOWN ){
			this.event.type = GameEvent.Press;
			Game.scene.onPress( this.event );
		}else if ( action == MotionEvent.ACTION_MOVE ){
			
		}
		return true;
	}
}